<template>
  <div class="page-banner">
    <div class="banner-overlay"></div>
    <!-- 移动面包屑到容器顶部 -->
    <div class="banner-breadcrumb" v-if="showBreadcrumb">
      <div class="container">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item>{{ title }}</el-breadcrumb-item>
        </el-breadcrumb>
      </div>
    </div>
    <div class="banner-content container">
      <h1 class="banner-title">{{ title }}</h1>
      <p class="banner-subtitle">{{ subtitle }}</p>
    </div>
  </div>
</template>

<script setup>
defineProps({
  title: String,
  subtitle: String,
  showBreadcrumb: {
    type: Boolean,
    default: true,
  },
});
</script>

<style scoped>
.page-banner {
  position: relative;
  height: 300px;
  background: linear-gradient(45deg, var(--primary-color), #36cfc9);
  background-image: url("https://toursmi.oss-cn-chengdu.aliyuncs.com/test.png");
  overflow: hidden;
  display: flex;
  align-items: center;
}

.page-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.1;
  animation: moveBackground 30s linear infinite;
}

.banner-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    transparent 0%,
    rgba(0, 0, 0, 0.3) 100%
  );
}

.banner-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.banner-title {
  font-size: 3.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 30%, rgba(255, 255, 255, 0.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

.banner-subtitle {
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards 0.2s;
}

/* 修改面包屑样式 */
.banner-breadcrumb {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  z-index: 2;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards 0.4s;
}

.banner-breadcrumb .container {
  text-align: left; /* 左对齐 */
}

.el-breadcrumb {
  --el-text-color-regular: rgba(255, 255, 255, 0.9);
  --el-text-color-primary: #fff;
  font-size: 0.9rem;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes moveBackground {
  from {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  to {
    transform: translate3d(-50%, -50%, 0) rotate(360deg);
  }
}

/* 响应式适配 */
@media (max-width: 768px) {
  .page-banner {
    height: 280px;
  }

  .banner-title {
    font-size: 2.2rem;
  }

  .banner-subtitle {
    font-size: 1rem;
    padding: 0 20px;
  }

  .banner-breadcrumb {
    top: 15px;
  }
}

@media (max-width: 480px) {
  .page-banner {
    height: 240px;
  }

  .banner-title {
    font-size: 1.8rem;
  }
}
</style>
